using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Shop;
using System;
using System.Data;
using System.IO;
using System.Text;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public class Web_SaleProduct : Shop, IRequiresSessionState
{
	private string Cs_TeamName = string.Empty;
	private string Cs_Title = string.Empty;
	private string Cs_Content = string.Empty;
	private bool Needinvoid = false;
	protected ScriptManager ScriptManager1;
	protected RadioButtonList RadioButtonList_ProductType;
	protected Label ClassName;
	protected HiddenField ClassID;
	protected HtmlGenericControl ClassBarDiv;
	protected TextBox ProductName;
	protected TextBox KeyWord;
	protected Label ImgPath;
	protected HtmlGenericControl previewImage;
	protected FileUpload FileUpload1;
	protected HtmlInputHidden Hidden1;
	protected Label Label1;
	protected HtmlGenericControl showviewImage2;
	protected FileUpload FileUpload2;
	protected HtmlInputHidden Hidden2;
	protected Label Label3;
	protected HtmlGenericControl showviewImage3;
	protected FileUpload FileUpload3;
	protected HtmlInputHidden Hidden3;
	protected Label Label5;
	protected HtmlGenericControl showviewImage4;
	protected FileUpload FileUpload4;
	protected HtmlInputHidden Hidden4;
	protected Label Label7;
	protected HtmlGenericControl showviewImage5;
	protected FileUpload FileUpload5;
	protected HtmlInputHidden Hidden5;
	protected RadioButtonList proudct_video_type;
	protected TextBox Product_VideoUrl;
	protected RegularExpressionValidator RegularExpressionValidator1;
	protected FileUpload FileUploadVideo;
	protected Literal UploadVideoTips;
	protected HtmlTableRow upload_video_tr;
	protected TextBox ProductDescripe;
	protected RadioButtonList RadioButtonList_Color;
	protected CheckBoxList CheckBoxList_Color;
	protected RadioButtonList RadioButtonList_Size;
	protected HtmlInputText Text_SizeSum;
	protected DropDownList DropDownList_Attributes;
	protected Panel AttributesPanel;
	protected HtmlGenericControl AttributesDiv;
	protected UpdatePanel UpdatePanel2;
	protected TextBox TxtPuint;
	protected TextBox ProductStock;
	protected RequiredFieldValidator rfv3;
	protected RangeValidator rav_2;
	protected RadioButtonList ProductStandard;
	protected Shop_UserControls_HowaveProvinceCity ProvinceCity;
	protected RadioButtonList NeedInvoice;
	protected TextBox TxtTaxRate;
	protected RequiredFieldValidator RequiredFieldValidator1;
	protected RangeValidator RangeValidator1;
	protected RadioButtonList Guarantee;
	protected CheckBox CheckBox_Integral;
	protected Panel ShowIntegral;
	protected TextBox CustomPrice;
	protected Panel ShowMarketPrice;
	protected TextBox StandPrice;
	protected RegularExpressionValidator revStandPrice;
	protected RadioButtonList userMemberCard;
	protected TextBox AuctionPrice;
	protected RegularExpressionValidator revAuctionPrice;
	protected TextBox AuctionAddPrice;
	protected RegularExpressionValidator revAuctionAddPrice;
	protected TextBox OriginallyPrice;
	protected RegularExpressionValidator revOriginallyPrice;
	protected DropDownList DropTeamNum;
	protected Literal TeamName1;
	protected TextBox TeamNumber1;
	protected TextBox TeamPrice1;
	protected Literal TeamName2;
	protected TextBox TeamNumber2;
	protected TextBox TeamPrice2;
	protected Literal TeamName3;
	protected TextBox TeamNumber3;
	protected TextBox TeamPrice3;
	protected Literal TeamName4;
	protected TextBox TeamNumber4;
	protected TextBox TeamPrice4;
	protected Literal TeamName5;
	protected TextBox TeamNumber5;
	protected TextBox TeamPrice5;
	protected TextBox OrderMoneyPercent;
	protected Label TeamCount_Error;
	protected TextBox MarketPrice;
	protected RegularExpressionValidator RegularExpressionValidator2;
	protected TextBox PromotePrice;
	protected RegularExpressionValidator revPromotePrice;
	protected HtmlInputText BeginTimeDay;
	protected DropDownList BeginTimeHour;
	protected DropDownList BeginTimeMM;
	protected HtmlInputText EndTimeDay;
	protected DropDownList EndTimeHour;
	protected DropDownList EndTimeMM;
	protected TextBox txtCommodityprices;
	protected CheckBoxList CheckBoxList_OnlinePayType;
	protected Label paytypeText;
	protected LinkButton LbtPay;
	protected RadioButtonList Radio_DeliverPayType;
	protected RadioButtonList CheckBoxList_DeliverType;
	protected Label deliverText;
	protected RadioButtonList PromoteSet;
	protected TextBox TxtDiscount;
	protected RequiredFieldValidator rfv4;
	protected RangeValidator rav_1;
	protected TextBox TxtPresentExp;
	protected RequiredFieldValidator rfv_5;
	protected RangeValidator rav_3;
	protected TextBox TxtPresentPoint;
	protected RequiredFieldValidator rfv_6;
	protected RangeValidator rav_18;
	protected TextBox TxtPresentMoney;
	protected RequiredFieldValidator rfv_7;
	protected RangeValidator rav_4;
	protected TextBox TxtDiscount1;
	protected RequiredFieldValidator rfv_8;
	protected RangeValidator rav_6;
	protected TextBox TxtPresentExp1;
	protected RequiredFieldValidator rfv_9;
	protected RangeValidator rav_5;
	protected TextBox TxtPresentPoint1;
	protected RequiredFieldValidator rfv_10;
	protected RangeValidator rav_7;
	protected TextBox TxtPresentMoney1;
	protected RequiredFieldValidator rfv_11;
	protected RangeValidator rav_8;
	protected TextBox TxtDiscount2;
	protected RequiredFieldValidator rfv_12;
	protected RangeValidator rav_10;
	protected TextBox TxtPresentExp2;
	protected RequiredFieldValidator rfv_13;
	protected RangeValidator rav_11;
	protected TextBox TxtPresentPoint2;
	protected RequiredFieldValidator rfv_14;
	protected RangeValidator rav_12;
	protected TextBox TxtPresentMoney2;
	protected RequiredFieldValidator rfv_15;
	protected RangeValidator rav_9;
	protected TextBox TxtDiscount3;
	protected RequiredFieldValidator rfv_16;
	protected RangeValidator rav_14;
	protected TextBox TxtPresentExp3;
	protected RequiredFieldValidator Rq7;
	protected RangeValidator Rg15;
	protected TextBox TxtPresentPoint3;
	protected RequiredFieldValidator Rq18;
	protected RangeValidator Rg16;
	protected TextBox TxtPresentMoney3;
	protected RequiredFieldValidator Rq19;
	protected RangeValidator Rg13;
	protected DropDownList ValidDay;
	protected HtmlTableRow trHavaTime;
	protected RadioButtonList ProductPublishTime;
	protected HtmlInputText PublishStartDay;
	protected DropDownList PublishStartHour;
	protected DropDownList PublishStartMin;
	protected HtmlTableRow trTime;
	protected CheckBox AutoPostBack;
	protected DropDownList TemplateID;
	protected new DropDownList SkinID;
	protected CheckBox IsElite;
	protected TextBox UserRemark;
	protected UpdatePanel UpdatePanel1;
	protected Button btnUploadPic1;
	protected Button btnUploadPic2;
	protected Button btnUploadPic3;
	protected Button btnUploadPic4;
	protected Button btnUploadPic5;
	protected Button Button3;
	protected ListBox listGoods;
	protected TextBox priceBox;
	protected TextBox CountBox;
	protected Button Addright;
	protected Button Addleft;
	protected ListBox listGet;
	protected UpdatePanel UpdatePanel3;
	protected HtmlForm form1;
	protected HtmlGenericControl myhtml;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_PreInit(object sender, EventArgs e)
	{
		if (!base.user.CheckUserLogin())
		{
			this.WriteErrMsg("", Language.GetMemberMsg("Common/NotLogin", new string[0]), "Passport/Login.aspx?ComeUrl=" + this.InstallDir + "SaleProduct.aspx");
		}
		try
		{
			Template.BindTemplateToPage(this.Page, "SaleProduct");
		}
		catch (Exception ex)
		{
			base.WriteTemErrMsg(ex.Message.ToString());
		}
		if (Fetch.GetCookies("Howave_UserID") != null && Fetch.GetCookies("Howave_UserID") != "")
		{
			this.ShowZHProduct(int.Parse(Fetch.GetCookies("Howave_UserID")));
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		base.ShowCityArea();
		if (!base.IsPostBack)
		{
			int userID = int.Parse(Fetch.GetCookies("Howave_UserID"));
			if (!this.OpenShop(userID))
			{
				this.WriteErrMsg("", Language.Get("Member/Common/NoShop"), "/Member/Shop_OpenShop.aspx");
			}
			this.Initpage();
			this.BindDeliverType();
			this.BindPayType();
			this.ViewState["HtmlTable"] = 0;
			this.priceBox.Text = "0";
			this.CountBox.Text = "0";
			this.FileUpload1.Attributes.Add("onchange", "SubmitPicFile('" + this.btnUploadPic1.ClientID + "');");
			this.FileUpload2.Attributes.Add("onchange", "SubmitPicFile('" + this.btnUploadPic2.ClientID + "');");
			this.FileUpload3.Attributes.Add("onchange", "SubmitPicFile('" + this.btnUploadPic3.ClientID + "');");
			this.FileUpload4.Attributes.Add("onchange", "SubmitPicFile('" + this.btnUploadPic4.ClientID + "');");
			this.FileUpload5.Attributes.Add("onchange", "SubmitPicFile('" + this.btnUploadPic5.ClientID + "');");
			string innerHtml = "<img src='UpLoadFile/ShopPic/default_goods_image.gif' width='100px' height='100px' border=0>";
			this.previewImage.InnerHtml = innerHtml;
			this.showviewImage2.InnerHtml = innerHtml;
			this.showviewImage3.InnerHtml = innerHtml;
			this.showviewImage4.InnerHtml = innerHtml;
			this.showviewImage5.InnerHtml = innerHtml;
		}
		this.PublishStartDay.Attributes.Add("onclick", "SelectDate(" + this.PublishStartDay.UniqueID + ",'yyyy/MM/dd');");
		this.BeginTimeDay.Attributes.Add("onclick", "SelectDate(" + this.BeginTimeDay.UniqueID + ",'yyyy/MM/dd');");
		this.EndTimeDay.Attributes.Add("onclick", "SelectDate(" + this.EndTimeDay.UniqueID + ",'yyyy/MM/dd');");
	}
	public bool OpenShop(int UserID)
	{
		Shop_Product shop_Product = new Shop_Product();
		return shop_Product.JustOpenShop(UserID);
	}
	protected void Initpage()
	{
		Shop_ProductAttributes shop_ProductAttributes = new Shop_ProductAttributes();
		this.DropDownList_Attributes.DataSource = shop_ProductAttributes.GetAllAttributesType();
		this.DropDownList_Attributes.DataBind();
		this.DropDownList_Attributes.Items.Insert(0, new ListItem("－请选择商品类型－", ""));
		if (base.user.CheckGroupPower("allowsaleproduct"))
		{
			int num = Text.ToInt32(base.user.GetGroupPower("maxproduct"));
			if (num > 0)
			{
				Shop_Product shop_Product = new Shop_Product(this.conn);
				if (num <= shop_Product.CountUserProductNum(base.user.UserID))
				{
					this.WriteErrMsg("", Language.Get("Shop/Product/SlalerProdNumErr", num.ToString()), "");
				}
			}
		}
		else
		{
			if (base.user.ShopID <= 0)
			{
				this.WriteErrMsg("", Language.Get("Shop/Product/NotAllowSale"), "");
			}
		}
		if (!base.user.CheckGroupPower("allowpublishmarketprice"))
		{
			this.ShowMarketPrice.Visible = false;
		}
		if (!base.user.CheckGroupPower("allowmedia"))
		{
			this.upload_video_tr.Style["display"] = "none";
		}
		if (!base.user.CheckGroupPower("allowIntegral"))
		{
			this.ShowIntegral.Visible = false;
		}
		if (base.shopconfig["Showstandprice"].ToString() != "1")
		{
			for (int i = 0; i < this.RadioButtonList_ProductType.Items.Count; i++)
			{
				if (this.RadioButtonList_ProductType.Items[i].Value == "1")
				{
					this.RadioButtonList_ProductType.Items.Remove(this.RadioButtonList_ProductType.Items[i]);
				}
			}
		}
		if (base.shopconfig["ShowAction"].ToString() != "1")
		{
			for (int i = 0; i < this.RadioButtonList_ProductType.Items.Count; i++)
			{
				if (this.RadioButtonList_ProductType.Items[i].Value == "2")
				{
					this.RadioButtonList_ProductType.Items.Remove(this.RadioButtonList_ProductType.Items[i]);
				}
			}
		}
		if (base.shopconfig["ShowTeam"].ToString() != "1")
		{
			for (int i = 0; i < this.RadioButtonList_ProductType.Items.Count; i++)
			{
				if (this.RadioButtonList_ProductType.Items[i].Value == "3")
				{
					this.RadioButtonList_ProductType.Items.Remove(this.RadioButtonList_ProductType.Items[i]);
				}
			}
		}
		if (base.shopconfig["ShowPromote"].ToString() != "1")
		{
			for (int i = 0; i < this.RadioButtonList_ProductType.Items.Count; i++)
			{
				if (this.RadioButtonList_ProductType.Items[i].Value == "4")
				{
					this.RadioButtonList_ProductType.Items.Remove(this.RadioButtonList_ProductType.Items[i]);
				}
			}
		}
		this.TeamName1.Text = base.shopconfig["Team1Name"].ToString();
		this.TeamName2.Text = base.shopconfig["Team2Name"].ToString();
		this.TeamName3.Text = base.shopconfig["Team3Name"].ToString();
		this.TeamName4.Text = base.shopconfig["Team4Name"].ToString();
		this.TeamName5.Text = base.shopconfig["Team5Name"].ToString();
		int num2 = Convert.ToInt32(base.shopconfig["TeamSet"]);
		for (int i = 1; i <= num2; i++)
		{
			ListItem item = new ListItem(i.ToString(), i.ToString());
			this.DropTeamNum.Items.Add(item);
		}
		this.ProvinceCity.SelectedProvince = base.user.UserInforRes["Province"].ToString();
		this.ProvinceCity.SelectedCity = base.user.UserInforRes["City"].ToString();
		string text = base.shopconfig["SaleDay"].ToString();
		if (text.Contains("|"))
		{
			string[] array = text.Split(new char[]
			{
				'|'
			});
			for (int i = 0; i < array.Length; i++)
			{
				this.ValidDay.Items.Add(array[i]);
			}
		}
	}
	protected void BindDeliverType()
	{
		Shop_DeliverType shop_DeliverType = new Shop_DeliverType(this.conn);
		DataTable deliverTypeByUserIDTypeIDStatus = shop_DeliverType.GetDeliverTypeByUserIDTypeIDStatus(base.user.UserID, -1, 0);
		if (deliverTypeByUserIDTypeIDStatus.Rows.Count > 0)
		{
			this.CheckBoxList_DeliverType.DataSource = deliverTypeByUserIDTypeIDStatus;
			this.CheckBoxList_DeliverType.DataTextField = "typename";
			this.CheckBoxList_DeliverType.DataValueField = "typeid";
			this.CheckBoxList_DeliverType.DataBind();
			foreach (ListItem listItem in this.CheckBoxList_DeliverType.Items)
			{
				listItem.Selected = true;
			}
		}
		else
		{
			this.deliverText.Text = Language.Get("Shop/Product/NoDeliverType");
		}
	}
	protected void BindPayType()
	{
		Shop_PayType shop_PayType = new Shop_PayType(this.conn);
		DataTable unDisabledPayTypeByUserID = shop_PayType.GetUnDisabledPayTypeByUserID(base.user.UserID);
		if (unDisabledPayTypeByUserID.Rows.Count > 0)
		{
			this.CheckBoxList_OnlinePayType.DataSource = unDisabledPayTypeByUserID;
			this.CheckBoxList_OnlinePayType.DataTextField = "typename";
			this.CheckBoxList_OnlinePayType.DataValueField = "typeid";
			this.CheckBoxList_OnlinePayType.DataBind();
			this.CheckBoxList_OnlinePayType.Items.Insert(0, "商城帐户支付");
			this.CheckBoxList_OnlinePayType.Items[0].Value = "0";
			this.CheckBoxList_OnlinePayType.Items[0].Selected = true;
		}
		else
		{
			this.paytypeText.Text = Language.Get("Shop/Product/没有设置支付方式");
		}
	}
	protected void Button_Submit_Click(object sender, EventArgs e)
	{
		string color = "";
		if (this.RadioButtonList_Color.SelectedValue == "1")
		{
			string text = "";
			for (int i = 0; i < this.CheckBoxList_Color.Items.Count; i++)
			{
				if (this.CheckBoxList_Color.Items[i].Selected)
				{
					text = text + this.CheckBoxList_Color.Items[i].Value + "|";
				}
			}
			if (text != "")
			{
				color = text.Substring(0, text.Length - 1);
			}
		}
		string size = "";
		if (this.RadioButtonList_Size.SelectedValue == "1")
		{
			size = this.Text_SizeSum.Value.Substring(0, this.Text_SizeSum.Value.Length - 1);
		}
		int num = int.Parse(this.ViewState["HtmlTable"].ToString());
		string text2 = "";
		for (int i = 0; i < num; i++)
		{
			if (base.Request.Form["TextBox_" + i] != null)
			{
				if (base.Request.Form["TextBox_" + i].ToString() != "")
				{
					string text3 = text2;
					text2 = string.Concat(new string[]
					{
						text3,
						"<strong>",
						base.Request.Form["HiddenField_" + i].ToString(),
						"</strong>",
						base.Request.Form["TextBox_" + i].ToString(),
						"|"
					});
				}
			}
			else
			{
				if (base.Request.Form["DropDownList_" + i] != null)
				{
					if (base.Request.Form["DropDownList_" + i].ToString() != "")
					{
						string text3 = text2;
						text2 = string.Concat(new string[]
						{
							text3,
							"<strong>",
							base.Request.Form["HiddenField_" + i].ToString(),
							"</strong>",
							base.Request.Form["DropDownList_" + i].ToString(),
							"|"
						});
					}
				}
				else
				{
					if (base.Request.Form["CheckBoxList_" + i] != null)
					{
						string text4 = base.Request.Form["CheckBoxList_" + i].Replace(",", " / ");
						string text3 = text2;
						text2 = string.Concat(new string[]
						{
							text3,
							"<strong>",
							base.Request.Form["HiddenField_" + i].ToString(),
							"</strong>",
							text4,
							"|"
						});
					}
				}
			}
		}
		decimal partPrice = 0m;
		if (this.CheckInput())
		{
			string text5 = string.Empty;
			text5 = this.UploadPicMakeSamllPic();
			if (text5 == string.Empty)
			{
				text5 = this.ImgPath.Text;
			}
			string text6 = string.Empty;
			if (this.proudct_video_type.SelectedValue == "url")
			{
				text6 = this.Product_VideoUrl.Text;
			}
			else
			{
				if (this.proudct_video_type.SelectedValue == "file")
				{
					text6 = this.UploadVideo();
					if (text6 == string.Empty)
					{
						text6 = this.Product_VideoUrl.Text;
					}
				}
			}
			Shop_Product shop_Product = new Shop_Product(this.conn);
			DateTime beginDate = DateTime.Now;
			if (this.ProductPublishTime.SelectedValue == "2")
			{
				beginDate = Convert.ToDateTime(string.Concat(new string[]
				{
					this.PublishStartDay.Value,
					" ",
					this.PublishStartHour.SelectedValue,
					":",
					this.PublishStartHour.SelectedValue,
					":00"
				}));
			}
			DateTime endDate = beginDate.AddDays(double.Parse(this.ValidDay.SelectedValue));
			bool flag = true;
			if (this.ProductPublishTime.SelectedValue == "0")
			{
				flag = false;
			}
			decimal num2 = Text.ToDecimal(this.StandPrice.Text);
			decimal num3 = Text.ToDecimal(this.PromotePrice.Text);
			decimal standPrice = num2;
			decimal d = num2;
			if (this.RadioButtonList_ProductType.SelectedValue == "1")
			{
				num2 = Text.ToDecimal(this.StandPrice.Text);
			}
			else
			{
				if (this.RadioButtonList_ProductType.SelectedValue == "2")
				{
					num2 = (standPrice = Text.ToDecimal(this.AuctionPrice.Text));
				}
				else
				{
					if (this.RadioButtonList_ProductType.SelectedValue == "3")
					{
						switch (Text.ToInt32(this.DropTeamNum.SelectedValue))
						{
						case 1:
							d = Text.ToDecimal(this.TeamPrice1.Text);
							break;
						case 2:
							d = Text.ToDecimal(this.TeamPrice2.Text);
							break;
						case 3:
							d = Text.ToDecimal(this.TeamPrice3.Text);
							break;
						case 4:
							d = Text.ToDecimal(this.TeamPrice4.Text);
							break;
						}
						num2 = Text.ToDecimal(this.OriginallyPrice.Text);
						standPrice = num2;
						if (this.OrderMoneyPercent.Text != "")
						{
							decimal d2 = Convert.ToDecimal(this.OrderMoneyPercent.Text);
							if (d2 > 0m)
							{
								if (d2 / 100m * num2 > d)
								{
									this.WriteErrMsg("", Language.Get("Shop/Product/RatePrice"), "");
								}
							}
						}
					}
					else
					{
						if (this.RadioButtonList_ProductType.SelectedValue == "4")
						{
							standPrice = (num2 = Text.ToDecimal(this.PromotePrice.Text));
							beginDate = Convert.ToDateTime(string.Concat(new string[]
							{
								this.BeginTimeDay.Value,
								" ",
								this.BeginTimeHour.SelectedValue,
								":",
								this.BeginTimeMM.SelectedValue,
								":00"
							}));
							endDate = Convert.ToDateTime(string.Concat(new string[]
							{
								this.EndTimeDay.Value,
								" ",
								this.EndTimeHour.SelectedValue,
								":",
								this.EndTimeMM.SelectedValue,
								":00"
							}));
						}
					}
				}
			}
			StringBuilder stringBuilder = new StringBuilder();
			foreach (ListItem listItem in this.CheckBoxList_OnlinePayType.Items)
			{
				if (listItem.Selected)
				{
					stringBuilder.Append(listItem.Value + "|");
				}
			}
			if (stringBuilder.Length > 0)
			{
				stringBuilder.Remove(stringBuilder.Length - 1, 1);
			}
			decimal num4 = Convert.ToDecimal(this.OrderMoneyPercent.Text);
			if (num4 < 1m)
			{
				num4 = 0m;
			}
			int validDay = int.Parse(this.ValidDay.SelectedValue);
			if (this.RadioButtonList_ProductType.SelectedValue == "4")
			{
				validDay = 0;
			}
			DataTable dataTable = shop_Product.AddProduct(base.user.ShopID, base.user.UserID, 0, this.ProvinceCity.SelectedText, "", Text.ToInt32(this.ClassID.Value), this.ProductName.Text, "", this.ProductStandard.Text, "", "", this.ProductDescripe.Text, text5, this.RadioButtonList_ProductType.SelectedValue, standPrice, Text.ToDecimal(this.AuctionPrice.Text), Text.ToDecimal(this.AuctionAddPrice.Text), Text.ToDecimal(this.MarketPrice.Text), num2, this.Cs_TeamName, Text.ToInt32(this.DropTeamNum.SelectedValue), Text.ToDecimal(this.TeamPrice1.Text), num4, Text.ToInt32(this.TeamNumber1.Text), Text.ToDecimal(this.TeamPrice2.Text), Text.ToInt32(this.TeamNumber2.Text), Text.ToDecimal(this.TeamPrice3.Text), Text.ToInt32(this.TeamNumber3.Text), Text.ToDecimal(this.TeamPrice4.Text), Text.ToInt32(this.TeamNumber4.Text), Text.ToDecimal(this.TeamPrice5.Text), Text.ToInt32(this.TeamNumber5.Text), this.IsElite.Checked, Text.ToInt32(this.ProductStock.Text), true, this.KeyWord.Text, base.user.UserName, 0, 0, "", this.CheckBoxList_DeliverType.SelectedValue, "", this.Needinvoid, Convert.ToBoolean(this.Guarantee.SelectedValue), validDay, this.AutoPostBack.Checked, this.UserRemark.Text, Convert.ToInt32(this.Radio_DeliverPayType.SelectedValue), stringBuilder.ToString(), stringBuilder.ToString(), 0, 0, false, false, 0, beginDate, endDate, 0, flag, Text.ToInt32(this.TemplateID.SelectedValue), Text.ToInt32(this.SkinID.SelectedValue), Text.ToInt32(this.TxtDiscount.Text), Text.ToInt32(this.TxtPresentExp.Text), Text.ToInt32(this.TxtPresentPoint.Text), Text.ToDecimal(this.TxtPresentMoney.Text), Text.ToInt32(this.TxtDiscount1.Text), Text.ToInt32(this.TxtPresentExp1.Text), Text.ToInt32(this.TxtPresentPoint1.Text), Text.ToDecimal(this.TxtPresentMoney1.Text), Text.ToInt32(this.TxtDiscount2.Text), Text.ToInt32(this.TxtPresentExp2.Text), Text.ToInt32(this.TxtPresentPoint2.Text), Text.ToDecimal(this.TxtPresentMoney2.Text), Text.ToInt32(this.TxtDiscount3.Text), Text.ToInt32(this.TxtPresentExp3.Text), Text.ToInt32(this.TxtPresentPoint3.Text), Text.ToDecimal(this.TxtPresentMoney3.Text), this.TxtPuint.Text, this.ProductPublishTime.SelectedValue, text5, Text.ToDecimal(this.TxtTaxRate.Text), text6, this.ProvinceCity.SelectedProvince, this.ProvinceCity.SelectedCity, color, size, text2, partPrice, "默认", "默认", this.CustomPrice.Text, this.CheckBox_Integral.Checked);
			if (flag)
			{
				Shop_Class shop_Class = new Shop_Class(this.conn);
				shop_Class.UpdateItemCountByClassIDType(Text.ToInt32(this.ClassID.Value), "addproduct");
			}
			int num5 = int.Parse(Fetch.GetCookies("Howave_UserID"));
			int num6 = int.Parse(dataTable.Rows[0]["ProductID"].ToString());
			for (int j = 0; j < this.listGet.Items.Count; j++)
			{
				string[] array = this.listGet.Items[j].Value.Split(new char[]
				{
					','
				});
				string[] array2 = this.listGet.Items[j].Text.ToString().Split(new char[]
				{
					'￥'
				});
				if (array[1] == null || array[1] == "")
				{
					array[1] = "0";
				}
				if (array[2] == null || array[2] == "")
				{
					array[2] = "0";
				}
				shop_Product.AddGroupProduct(num5, num6, int.Parse(array[0]), this.ProductName.Text, array2[0], decimal.Parse(array[5]), decimal.Parse(array[2]), array[3], int.Parse(array[6]));
				int num7 = this.conn.Execute(string.Concat(new object[]
				{
					"update HLShop_Product set PartPrice=",
					decimal.Parse(array[5]),
					" where ProductID=",
					int.Parse(array[0])
				}));
			}
			string[] array3 = new string[5];
			array3[0] = this.Hidden1.Value.Trim();
			if (array3[0] == string.Empty)
			{
				array3[0] = "";
			}
			array3[1] = this.Hidden2.Value.Trim();
			if (array3[1] == string.Empty)
			{
				array3[1] = "";
			}
			array3[2] = this.Hidden3.Value.Trim();
			if (array3[2] == string.Empty)
			{
				array3[2] = "";
			}
			array3[3] = this.Hidden4.Value.Trim();
			if (array3[3] == string.Empty)
			{
				array3[3] = "";
			}
			array3[4] = this.Hidden5.Value.Trim();
			if (array3[4] == string.Empty)
			{
				array3[4] = "";
			}
			int num8 = this.conn.Execute(string.Concat(new object[]
			{
				"insert into HLShop_ProductImg(ProductID,SalerID,ImgPath1,Imgpath2,ImgPath3,ImgPath4,ImgPath5) values(",
				num6,
				",",
				num5,
				",'",
				array3[0],
				"','",
				array3[1],
				"','",
				array3[2],
				"','",
				array3[3],
				"','",
				array3[4],
				"')"
			}));
			this.WriteSuccessMsg("", "成功发布产品！<script>if(confirm('成功发布产品!是否继续发布?')){window.location.href='SaleProduct.aspx';}</script>", "/ShowProduct.aspx?ProductID=" + dataTable.Rows[0]["ProductID"].ToString());
		}
	}
	protected void btnUploadPic_Click(object sender, EventArgs e)
	{
		string text = this.UploadPicMakeSamllPic();
		string text2 = this.Hidden1.Value.Trim();
		if (!string.IsNullOrEmpty(text2))
		{
			File.Delete(base.Server.MapPath("~\\" + text2.Trim(new char[]
			{
				'\\'
			})));
		}
		this.Hidden1.Value = text;
		this.previewImage.InnerHtml = "";
		this.previewImage.InnerHtml = string.Concat(new string[]
		{
			"<img onmousemove=\"var pl=$(this).css('left');var pr=$(this).css('right');$('#DelDiv').show().css('left',pl).css('height',pr);$('#DelDiv').attr('path','",
			text,
			"');\" src='",
			text.Trim(new char[]
			{
				'\\',
				'/'
			}),
			"' width='100px' height='100px' border=0>"
		});
	}
	protected void btnUploadPic2_Click(object sender, EventArgs e)
	{
		string text = this.UploadPicMakeSamllPic2();
		string text2 = this.Hidden2.Value.Trim();
		if (!string.IsNullOrEmpty(text2))
		{
			File.Delete(base.Server.MapPath("~\\" + text2.Trim(new char[]
			{
				'\\'
			})));
		}
		this.Hidden2.Value = text;
		this.showviewImage2.InnerHtml = "";
		this.showviewImage2.InnerHtml = "<img src='" + text.Trim(new char[]
		{
			'\\',
			'/'
		}) + "' width='100px' height='100px' border=0>";
	}
	protected void btnUploadPic3_Click(object sender, EventArgs e)
	{
		string text = this.UploadPicMakeSamllPic3();
		string text2 = this.Hidden3.Value.Trim();
		if (!string.IsNullOrEmpty(text2))
		{
			File.Delete(base.Server.MapPath("~\\" + text2.Trim(new char[]
			{
				'\\'
			})));
		}
		this.Hidden3.Value = text;
		this.showviewImage3.InnerHtml = "";
		this.showviewImage3.InnerHtml = "<img src='" + text.Trim(new char[]
		{
			'\\',
			'/'
		}) + "' width='100px' height='100px' border=0>";
	}
	protected void btnUploadPic4_Click(object sender, EventArgs e)
	{
		string text = this.UploadPicMakeSamllPic4();
		string text2 = this.Hidden4.Value.Trim();
		if (!string.IsNullOrEmpty(text2))
		{
			File.Delete(base.Server.MapPath("~\\" + text2.Trim(new char[]
			{
				'\\'
			})));
		}
		this.Hidden4.Value = text;
		this.showviewImage4.InnerHtml = "";
		this.showviewImage4.InnerHtml = "<img src='" + text.Trim(new char[]
		{
			'\\',
			'/'
		}) + "' width='100px' height='100px' border=0>";
	}
	protected void btnUploadPic5_Click(object sender, EventArgs e)
	{
		string text = this.UploadPicMakeSamllPic5();
		string text2 = this.Hidden5.Value.Trim();
		if (!string.IsNullOrEmpty(text2))
		{
			File.Delete(base.Server.MapPath("~\\" + text2.Trim(new char[]
			{
				'\\'
			})));
		}
		this.Hidden5.Value = text;
		this.showviewImage5.InnerHtml = "";
		this.showviewImage5.InnerHtml = "<img src='" + text.Trim(new char[]
		{
			'\\',
			'/'
		}) + "' width='100px' height='100px' border=0>";
	}
	private string UploadPicMakeSamllPic()
	{
		string result;
		if (this.FileUpload1.HasFile)
		{
			UpLoadFile upLoadFile = new UpLoadFile();
			if (this.FileUpload1.PostedFile.ContentLength > Convert.ToInt32(base.user.GetGroupPower("AllowUploadSize")) * 1024)
			{
				this.WriteErrMsg("", Language.Get("Shop/Product/UpLoadTypeLarget", base.user.GetGroupPower("AllowUploadSize")), "");
			}
			result = upLoadFile.UploadPic(this.FileUpload1, this.config, "");
		}
		else
		{
			result = "";
		}
		return result;
	}
	private string UploadPicMakeSamllPic2()
	{
		string result;
		if (this.FileUpload2.HasFile)
		{
			UpLoadFile upLoadFile = new UpLoadFile();
			if (this.FileUpload2.PostedFile.ContentLength > Convert.ToInt32(base.user.GetGroupPower("AllowUploadSize")) * 1024)
			{
				this.WriteErrMsg("", Language.Get("Shop/Product/UpLoadTypeLarget", base.user.GetGroupPower("AllowUploadSize")), "");
			}
			result = upLoadFile.UploadPic(this.FileUpload2, this.config, "");
		}
		else
		{
			result = "";
		}
		return result;
	}
	private string UploadPicMakeSamllPic3()
	{
		string result;
		if (this.FileUpload3.HasFile)
		{
			UpLoadFile upLoadFile = new UpLoadFile();
			if (this.FileUpload3.PostedFile.ContentLength > Convert.ToInt32(base.user.GetGroupPower("AllowUploadSize")) * 1024)
			{
				this.WriteErrMsg("", Language.Get("Shop/Product/UpLoadTypeLarget", base.user.GetGroupPower("AllowUploadSize")), "");
			}
			result = upLoadFile.UploadPic(this.FileUpload3, this.config, "");
		}
		else
		{
			result = "";
		}
		return result;
	}
	private string UploadPicMakeSamllPic4()
	{
		string result;
		if (this.FileUpload4.HasFile)
		{
			UpLoadFile upLoadFile = new UpLoadFile();
			if (this.FileUpload4.PostedFile.ContentLength > Convert.ToInt32(base.user.GetGroupPower("AllowUploadSize")) * 1024)
			{
				this.WriteErrMsg("", Language.Get("Shop/Product/UpLoadTypeLarget", base.user.GetGroupPower("AllowUploadSize")), "");
			}
			result = upLoadFile.UploadPic(this.FileUpload4, this.config, "");
		}
		else
		{
			result = "";
		}
		return result;
	}
	private string UploadPicMakeSamllPic5()
	{
		string result;
		if (this.FileUpload5.HasFile)
		{
			UpLoadFile upLoadFile = new UpLoadFile();
			if (this.FileUpload5.PostedFile.ContentLength > Convert.ToInt32(base.user.GetGroupPower("AllowUploadSize")) * 1024)
			{
				this.WriteErrMsg("", Language.Get("Shop/Product/UpLoadTypeLarget", base.user.GetGroupPower("AllowUploadSize")), "");
			}
			result = upLoadFile.UploadPic(this.FileUpload5, this.config, "");
		}
		else
		{
			result = "";
		}
		return result;
	}
	private string UploadVideo()
	{
		string result;
		if (this.FileUploadVideo.HasFile)
		{
			UpLoadFile upLoadFile = new UpLoadFile();
			if (this.FileUploadVideo.PostedFile.ContentLength > Convert.ToInt32(base.user.GetGroupPower("AllowUploadSize")) * 1024)
			{
				this.WriteErrMsg("", Language.Get("Shop/Product/UpLoadTypeLarget", base.user.GetGroupPower("AllowUploadSize")), "");
			}
			result = upLoadFile.UploadVideo(this.FileUploadVideo, this.config, "");
		}
		else
		{
			result = "";
		}
		return result;
	}
	public bool CheckInput()
	{
		string text = string.Empty;
		string selectedValue = this.RadioButtonList_ProductType.SelectedValue;
		decimal num = 0m;
		if (this.CheckBoxList_DeliverType.SelectedIndex == -1 && this.Radio_DeliverPayType.SelectedValue != "0")
		{
			text = text + Language.Get("Shop/Deliver/DeliverTypeNull") + "<br/>";
		}
		if (this.ClassID.Value == string.Empty)
		{
			text = text + Language.Get("Shop/Product/ClassNull") + "<br/>";
		}
		if (this.ProvinceCity.SelectedText == string.Empty)
		{
			text = text + Language.Get("Shop/Product/ProductNameNull") + "<br/>";
		}
		if (this.TxtPuint.Text == string.Empty)
		{
			text = text + Language.Get("Shop/Product/PuintNull") + "<br/>";
		}
		if (selectedValue == string.Empty)
		{
			text = text + Language.Get("Shop/Product/ProductTypeNull") + "<br/>";
		}
		if (!Text.IsNumber(this.ProductStock.Text))
		{
			text = text + Language.Get("Shop/Product/Stock") + "<br/>";
		}
		bool result;
		if (selectedValue == "2")
		{
			try
			{
				Convert.ToDecimal(this.AuctionPrice.Text);
				Convert.ToDecimal(this.AuctionAddPrice.Text);
			}
			catch
			{
				text = text + Language.Get("Shop/Product/AuctionPriceErr") + "<br/>";
			}
			if (decimal.Parse(this.AuctionPrice.Text) <= 0m)
			{
				this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Test", "<script>alert('起拍价必须大于0!');</script>");
				result = false;
				return result;
			}
			if (decimal.Parse(this.AuctionAddPrice.Text) <= 0m)
			{
				this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Test", "<script>alert('起副价必须大于0!');</script>");
				result = false;
				return result;
			}
		}
		else
		{
			if (selectedValue == "3")
			{
				try
				{
					Convert.ToDecimal(this.OriginallyPrice.Text);
				}
				catch (Exception)
				{
					this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Test", "<script>alert('商品原价必须大于0!');</script>");
					result = false;
					return result;
				}
				if (decimal.Parse(this.OriginallyPrice.Text) <= 0m)
				{
					this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Test", "<script>alert('商品原价必须大于0!');</script>");
					result = false;
					return result;
				}
				if (this.TeamName1.Text.Trim() == "" || this.TeamName2.Text.Trim() == "" || this.TeamName3.Text.Trim() == "" || this.TeamName4.Text.Trim() == "" || this.TeamName5.Text.Trim() == "")
				{
					text = text + Language.Get("Shop/Product/TeamNameNull") + "<br/>";
				}
				else
				{
					this.Cs_TeamName = string.Concat(new string[]
					{
						this.TeamName1.Text,
						",",
						this.TeamName2.Text,
						",",
						this.TeamName3.Text,
						",",
						this.TeamName4.Text,
						",",
						this.TeamName5.Text
					});
				}
				try
				{
					num = Convert.ToDecimal(this.OriginallyPrice.Text);
					if (num <= 0m)
					{
						text = text + Language.Get("Shop/Product/OriginallyPriceNull") + "<br/>";
					}
				}
				catch
				{
					text = text + Language.Get("Shop/Product/OriginallyPriceErr") + "<br/>";
				}
				try
				{
					Convert.ToDecimal(this.OrderMoneyPercent.Text);
				}
				catch
				{
					text = text + Language.Get("Shop/Product/OrderMoneyPercentErr") + "<br/>";
				}
				int num2 = Convert.ToInt32(this.DropTeamNum.SelectedValue);
				if (num2 >= 1)
				{
					try
					{
						Convert.ToDecimal(this.TeamPrice1.Text);
					}
					catch
					{
						text = text + Language.Get("Shop/Product/TeamPriceErr", this.TeamName1.Text) + "<br/>";
					}
					try
					{
						Convert.ToInt32(this.TeamNumber1.Text);
					}
					catch
					{
						text = text + Language.Get("Shop/Product/TeamNumberErr", this.TeamName1.Text) + "<br/>";
					}
				}
				if (num2 >= 2)
				{
					try
					{
						Convert.ToDecimal(this.TeamPrice2.Text);
					}
					catch
					{
						text = text + Language.Get("Shop/Product/TeamPriceErr", this.TeamPrice2.Text) + "<br/>";
					}
					try
					{
						Convert.ToInt32(this.TeamNumber2.Text);
					}
					catch
					{
						text = text + Language.Get("Shop/Product/TeamNumberErr", this.TeamName2.Text) + "<br/>";
					}
				}
				if (num2 >= 3)
				{
					try
					{
						Convert.ToDecimal(this.TeamPrice3.Text);
					}
					catch
					{
						text = text + Language.Get("Shop/Product/TeamPriceErr", this.TeamPrice3.Text) + "<br/>";
					}
					try
					{
						Convert.ToInt32(this.TeamNumber3.Text);
					}
					catch
					{
						text = text + Language.Get("Shop/Product/TeamNumberErr", this.TeamNumber3.Text) + "<br/>";
					}
				}
				if (num2 >= 4)
				{
					try
					{
						Convert.ToDecimal(this.TeamPrice4.Text);
					}
					catch
					{
						text = text + Language.Get("Shop/Product/TeamPriceErr", this.TeamPrice4.Text) + "<br/>";
					}
					try
					{
						Convert.ToInt32(this.TeamNumber4.Text);
					}
					catch
					{
						text = text + Language.Get("Shop/Product/TeamNumberErr", this.TeamNumber4.Text) + "<br/>";
					}
				}
				if (num2 >= 5)
				{
					try
					{
						Convert.ToDecimal(this.TeamPrice5.Text);
					}
					catch
					{
						text = text + Language.Get("Shop/Product/TeamPriceErr", this.TeamPrice5.Text) + "<br/>";
					}
					try
					{
						Convert.ToInt32(this.TeamNumber5.Text);
					}
					catch
					{
						text = text + Language.Get("Shop/Product/TeamNumberErr", this.TeamNumber5.Text) + "<br/>";
					}
				}
				if (Text.ToDecimal(this.TeamNumber1.Text) <= 1m)
				{
					text = text + Language.Get("Shop/Product/TeamNumberErr", this.TeamName1.Text) + "<br/>";
				}
				switch (num2)
				{
				case 1:
					if (Convert.ToDecimal(this.TeamPrice1.Text) >= num)
					{
						text = text + Language.Get("Shop/Product/TeamPriceErr", this.TeamName1.Text) + "<br/>";
					}
					if (Convert.ToInt32(this.TeamNumber1.Text) > Convert.ToInt32(this.ProductStock.Text))
					{
						text = text + Language.Get("Shop/Product/StockErr") + "<br/>";
					}
					break;
				case 2:
					if (Text.ToInt32(this.TeamNumber2.Text) <= Text.ToInt32(this.TeamNumber1.Text))
					{
						text = text + Language.Get("Shop/Product/TeamNumberErr", this.TeamName2.Text) + "<br/>";
					}
					if (Text.ToDecimal(this.TeamPrice2.Text) >= Text.ToDecimal(this.TeamPrice1.Text) || Text.ToDecimal(this.TeamPrice1.Text) >= num)
					{
						text = text + Language.Get("Shop/Product/TeamPriceErr", "") + "<br/>";
					}
					if (Convert.ToInt32(this.TeamNumber2.Text) > Convert.ToInt32(this.ProductStock.Text))
					{
						text = text + Language.Get("Shop/Product/StockErr") + "<br/>";
					}
					break;
				case 3:
					if (Text.ToInt32(this.TeamNumber3.Text) <= Text.ToInt32(this.TeamNumber2.Text) || Text.ToInt32(this.TeamNumber2.Text) <= Text.ToInt32(this.TeamNumber1.Text))
					{
						text = text + Language.Get("Shop/Product/TeamNumberErr", "") + "<br/>";
					}
					if (Text.ToDecimal(this.TeamPrice3.Text) >= Text.ToDecimal(this.TeamPrice2.Text) || Text.ToDecimal(this.TeamPrice2.Text) >= Text.ToDecimal(this.TeamPrice1.Text) || Text.ToDecimal(this.TeamPrice1.Text) >= num)
					{
						text = text + Language.Get("Shop/Product/TeamPriceErr", "") + "<br/>";
					}
					if (Convert.ToInt32(this.TeamNumber3.Text) > Convert.ToInt32(this.ProductStock.Text))
					{
						text = text + Language.Get("Shop/Product/StockErr") + "<br/>";
					}
					break;
				case 4:
					if (Text.ToInt32(this.TeamNumber4.Text) <= Text.ToInt32(this.TeamNumber3.Text) || Text.ToInt32(this.TeamNumber3.Text) <= Text.ToInt32(this.TeamNumber2.Text) || Text.ToInt32(this.TeamNumber2.Text) <= Text.ToInt32(this.TeamNumber1.Text))
					{
						text = text + Language.Get("Shop/Product/TeamNumberErr", "") + "<br/>";
					}
					if (Text.ToDecimal(this.TeamPrice4.Text) >= Text.ToDecimal(this.TeamPrice3.Text) || Text.ToDecimal(this.TeamPrice3.Text) >= Text.ToDecimal(this.TeamPrice2.Text) || Text.ToDecimal(this.TeamPrice2.Text) >= Text.ToDecimal(this.TeamPrice1.Text) || Text.ToDecimal(this.TeamPrice1.Text) >= num)
					{
						text = text + Language.Get("Shop/Product/TeamPriceErr", "") + "<br/>";
					}
					if (Convert.ToInt32(this.TeamNumber4.Text) > Convert.ToInt32(this.ProductStock.Text))
					{
						text = text + Language.Get("Shop/Product/StockErr") + "<br/>";
					}
					break;
				case 5:
					if (Text.ToInt32(this.TeamNumber5.Text) <= Text.ToInt32(this.TeamNumber4.Text) || Text.ToInt32(this.TeamNumber4.Text) <= Text.ToInt32(this.TeamNumber3.Text) || Text.ToInt32(this.TeamNumber3.Text) <= Text.ToInt32(this.TeamNumber2.Text) || Text.ToInt32(this.TeamNumber2.Text) <= Text.ToInt32(this.TeamNumber1.Text))
					{
						text = text + Language.Get("Shop/Product/TeamNumberErr", "") + "<br/>";
					}
					if (Text.ToDecimal(this.TeamPrice5.Text) >= Text.ToDecimal(this.TeamPrice4.Text) || Text.ToDecimal(this.TeamPrice4.Text) >= Text.ToDecimal(this.TeamPrice3.Text) || Text.ToDecimal(this.TeamPrice3.Text) >= Text.ToDecimal(this.TeamPrice2.Text) || Text.ToDecimal(this.TeamPrice2.Text) >= Text.ToDecimal(this.TeamPrice1.Text) || Text.ToDecimal(this.TeamPrice1.Text) >= num)
					{
						text = text + Language.Get("Shop/Product/TeamPriceErr", "") + "<br/>";
					}
					if (Convert.ToInt32(this.TeamNumber5.Text) > Convert.ToInt32(this.ProductStock.Text))
					{
						text = text + Language.Get("Shop/Product/StockErr") + "<br/>";
					}
					break;
				}
			}
			else
			{
				if (selectedValue == "4")
				{
					try
					{
						Convert.ToDecimal(this.PromotePrice.Text);
					}
					catch
					{
						text = text + Language.Get("Shop/Product/PromotePriceErr") + "<br/>";
					}
					if (decimal.Parse(this.PromotePrice.Text) <= 0m)
					{
						this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Test", "<script>alert('秒杀价必须大于0!');</script>");
						result = false;
						return result;
					}
				}
				else
				{
					try
					{
						Convert.ToDecimal(this.StandPrice.Text);
					}
					catch
					{
						text = text + Language.Get("Shop/Product/StandPriceErr") + "<br/>";
					}
					if (decimal.Parse(this.StandPrice.Text) <= 0m)
					{
						this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Test", "<script>alert('一口价必须大于0!');</script>");
						result = false;
						return result;
					}
				}
			}
		}
		if (text.Trim().Length > 0)
		{
			this.WriteErrMsg("", text, "");
			result = false;
		}
		else
		{
			result = true;
		}
		return result;
	}
	protected void DropDownList_Attributes_SelectedIndexChanged(object sender, EventArgs e)
	{
		this.AttributesDiv.Visible = true;
		if (this.DropDownList_Attributes.SelectedValue == "")
		{
			this.AttributesDiv.Visible = false;
			this.ViewState["HtmlTable"] = 0;
		}
		else
		{
			this.AttributesPanel.Controls.Clear();
			Shop_ProductAttributes shop_ProductAttributes = new Shop_ProductAttributes();
			DataTable attributesNameByAttributesType = shop_ProductAttributes.GetAttributesNameByAttributesType(this.DropDownList_Attributes.SelectedValue);
			HtmlTable htmlTable = new HtmlTable();
			int num = 0;
			foreach (DataRow dataRow in attributesNameByAttributesType.Rows)
			{
				if (dataRow["Attributes_Select"].ToString() != "" || dataRow["Attributes_Select"].ToString() != null)
				{
					HtmlTableCell htmlTableCell = new HtmlTableCell();
					HtmlTableCell htmlTableCell2 = new HtmlTableCell();
					HtmlTableCell htmlTableCell3 = new HtmlTableCell();
					HtmlTableRow htmlTableRow = new HtmlTableRow();
					htmlTableCell.Style.Add("width", "80px");
					htmlTableCell.Style.Add("font-weight", "bold");
					htmlTableCell.Style.Add("text-align", "right");
					htmlTableCell2.Style.Add("text-align", "left");
					Label label = new Label();
					label.ID = "Label_" + num;
					HiddenField hiddenField = new HiddenField();
					hiddenField.ID = "HiddenField_" + num;
					TextBox textBox = new TextBox();
					textBox.ID = "TextBox_" + num;
					textBox.Width = 200;
					if (dataRow["Attributes_Methods"].ToString() == "从列表中选择")
					{
						if (dataRow["Attributes_Value"].ToString() != "")
						{
							label.Text = dataRow["Attributes_Name"].ToString() + "：";
							htmlTableCell.Controls.Add(label);
							hiddenField.Value = dataRow["Attributes_Name"].ToString() + "：";
							htmlTableCell3.Controls.Add(hiddenField);
						}
					}
					else
					{
						label.Text = dataRow["Attributes_Name"].ToString() + "：";
						htmlTableCell.Controls.Add(label);
						hiddenField.Value = dataRow["Attributes_Name"].ToString() + "：";
						htmlTableCell3.Controls.Add(hiddenField);
					}
					htmlTableRow.Controls.Add(htmlTableCell);
					htmlTableRow.Controls.Add(htmlTableCell3);
					if (dataRow["Attributes_Select"].ToString() == "唯一属性")
					{
						string text = dataRow["Attributes_Methods"].ToString();
						if (text != null)
						{
							if (!(text == "手工录入"))
							{
								if (!(text == "从列表中选择"))
								{
									if (text == "多行文本框")
									{
										textBox.TextMode = TextBoxMode.MultiLine;
										textBox.Width = 200;
										textBox.Height = 60;
										htmlTableCell2.Controls.Add(textBox);
									}
								}
								else
								{
									DropDownList dropDownList = new DropDownList();
									dropDownList.ID = "DropDownList_" + num;
									if (dataRow["Attributes_Value"].ToString() != "" && dataRow["Attributes_Value"].ToString() != null)
									{
										string text2 = dataRow["Attributes_Value"].ToString().Replace("\r\n", "|");
										string[] array = text2.Split(new char[]
										{
											'|'
										});
										string[] array2 = array;
										for (int i = 0; i < array2.Length; i++)
										{
											string text3 = array2[i];
											ListItem listItem = new ListItem();
											listItem.Text = text3;
											listItem.Value = text3;
											dropDownList.Items.Add(listItem);
										}
									}
									dropDownList.Items.Insert(0, new ListItem("－请选择－", ""));
									htmlTableCell2.Controls.Add(dropDownList);
								}
							}
							else
							{
								htmlTableCell2.Controls.Add(textBox);
							}
						}
						htmlTableRow.Controls.Add(htmlTableCell2);
						htmlTable.Controls.Add(htmlTableRow);
						this.AttributesPanel.Controls.Add(htmlTable);
					}
					if (dataRow["Attributes_Select"].ToString() == "单选属性")
					{
						string text = dataRow["Attributes_Methods"].ToString();
						if (text != null)
						{
							if (!(text == "手工录入"))
							{
								if (!(text == "从列表中选择"))
								{
									if (text == "多行文本框")
									{
										textBox.TextMode = TextBoxMode.MultiLine;
										textBox.Width = 200;
										textBox.Height = 60;
										htmlTableCell2.Controls.Add(textBox);
									}
								}
								else
								{
									DropDownList dropDownList = new DropDownList();
									dropDownList.ID = "DropDownList_" + num;
									if (dataRow["Attributes_Value"].ToString() != "" && dataRow["Attributes_Value"].ToString() != null)
									{
										string text2 = dataRow["Attributes_Value"].ToString().Replace("\r\n", "|");
										string[] array = text2.Split(new char[]
										{
											'|'
										});
										string[] array2 = array;
										for (int i = 0; i < array2.Length; i++)
										{
											string text3 = array2[i];
											ListItem listItem = new ListItem();
											listItem.Text = text3;
											listItem.Value = text3;
											dropDownList.Items.Add(listItem);
										}
									}
									dropDownList.Items.Insert(0, new ListItem("－请选择－", ""));
									htmlTableCell2.Controls.Add(dropDownList);
								}
							}
							else
							{
								htmlTableCell2.Controls.Add(textBox);
							}
						}
						htmlTableRow.Controls.Add(htmlTableCell2);
						htmlTable.Controls.Add(htmlTableRow);
						this.AttributesPanel.Controls.Add(htmlTable);
					}
					if (dataRow["Attributes_Select"].ToString() == "复选属性")
					{
						string text = dataRow["Attributes_Methods"].ToString();
						if (text != null)
						{
							if (!(text == "手工录入"))
							{
								if (!(text == "从列表中选择"))
								{
									if (text == "多行文本框")
									{
										textBox.TextMode = TextBoxMode.MultiLine;
										textBox.Width = 200;
										textBox.Height = 60;
										htmlTableCell2.Controls.Add(textBox);
									}
								}
								else
								{
									string text4 = "";
									CheckBoxList checkBoxList = new CheckBoxList();
									checkBoxList.ID = "CheckBoxList_" + num;
									if (dataRow["Attributes_Value"].ToString() != "" && dataRow["Attributes_Value"].ToString() != null)
									{
										string text2 = dataRow["Attributes_Value"].ToString().Replace("\r\n", "|");
										string[] array = text2.Split(new char[]
										{
											'|'
										});
										string[] array2 = array;
										for (int i = 0; i < array2.Length; i++)
										{
											string text3 = array2[i];
											ListItem listItem = new ListItem();
											listItem.Text = text3;
											listItem.Value = text3;
											checkBoxList.Items.Add(listItem);
											object obj = text4;
											text4 = string.Concat(new object[]
											{
												obj,
												"<input name='CheckBoxList_",
												num,
												"' type='checkbox'  id='CheckBoxList_",
												num,
												"' value='",
												text3,
												"' >",
												text3,
												"  "
											});
										}
									}
									htmlTableCell2.InnerHtml = text4;
								}
							}
							else
							{
								htmlTableCell2.Controls.Add(textBox);
							}
						}
						htmlTableRow.Controls.Add(htmlTableCell2);
						htmlTable.Controls.Add(htmlTableRow);
						this.AttributesPanel.Controls.Add(htmlTable);
					}
				}
				num++;
			}
			this.ViewState["HtmlTable"] = htmlTable.Controls.Count;
		}
	}
	public void ShowZHProduct(int SalerID)
	{
		Shop_Product shop_Product = new Shop_Product();
		this.listGoods.DataSource = shop_Product.GetListSalerProduct(SalerID);
		this.listGoods.DataTextField = "ProductPrice";
		this.listGoods.DataValueField = "GetStrchar";
		this.listGoods.DataBind();
	}
	protected void Addright_Click(object sender, EventArgs e)
	{
		this.listGet.SelectedIndex = -1;
		for (int i = 0; i < this.listGoods.Items.Count; i++)
		{
			if (this.listGoods.Items[i].Selected)
			{
				for (int j = 0; j < this.listGet.Items.Count; j++)
				{
					if (this.listGoods.Items[i].Text == this.listGet.Items[j].Text)
					{
						this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Test", "<script>alert('不能重复添加商品！');</script>");
						return;
					}
				}
				try
				{
					decimal num = decimal.Parse(this.priceBox.Text);
				}
				catch
				{
					this.WriteSuccessMsg("", "输入配件价格无效!", "");
					break;
				}
				int num2;
				try
				{
					num2 = int.Parse(this.CountBox.Text);
				}
				catch
				{
					this.WriteSuccessMsg("", "输入配件数量不是有效数量！", "");
					break;
				}
				string[] array = this.listGoods.Items[i].Value.Split(new char[]
				{
					','
				});
				if (int.Parse(array[4]) < num2)
				{
					this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Test", "<script>alert('该商品数只有" + array[4] + "！');</script>");
					break;
				}
				this.listGoods.Items[i].Value = string.Concat(new string[]
				{
					this.listGoods.Items[i].Value,
					",",
					this.priceBox.Text,
					",",
					this.CountBox.Text
				});
				this.listGet.Items.Add(this.listGoods.Items[i]);
				this.listGet.SelectedIndex = -1;
				this.listGoods.Items.Remove(this.listGoods.Items[i]);
			}
		}
	}
	protected void Addleft_Click(object sender, EventArgs e)
	{
		this.listGoods.SelectedIndex = -1;
		for (int i = 0; i < this.listGet.Items.Count; i++)
		{
			if (this.listGet.Items[i].Selected)
			{
				string[] array = this.listGet.Items[i].Value.Split(new char[]
				{
					','
				});
				this.listGet.Items[i].Value = string.Concat(new string[]
				{
					array[0],
					",",
					array[1],
					",",
					array[2],
					",",
					array[3],
					",",
					array[4]
				});
				this.listGoods.Items.Add(this.listGet.Items[i]);
				this.listGoods.SelectedIndex = -1;
				this.listGet.Items.Remove(this.listGet.Items[i]);
			}
		}
	}
	public bool Isnumberic(object number)
	{
		bool result;
		try
		{
			double num = Convert.ToDouble(number);
			result = true;
		}
		catch
		{
			result = false;
		}
		return result;
	}
	protected void listGoods_SelectedIndexChanged(object sender, EventArgs e)
	{
		this.listGet.SelectedIndex = -1;
		for (int i = 0; i < this.listGoods.Items.Count; i++)
		{
			if (this.listGoods.Items[i].Selected)
			{
				string[] array = this.listGoods.Items[i].Value.Split(new char[]
				{
					','
				});
				this.priceBox.Text = array[1];
				this.CountBox.Text = array[4];
			}
		}
	}
	protected void listGet_SelectedIndexChanged(object sender, EventArgs e)
	{
		this.listGoods.SelectedIndex = -1;
		for (int i = 0; i < this.listGet.Items.Count; i++)
		{
			if (this.listGet.Items[i].Selected)
			{
				string[] array = this.listGet.Items[i].Value.Split(new char[]
				{
					','
				});
				this.priceBox.Text = array[1];
				this.CountBox.Text = array[4];
			}
		}
	}
	protected void NeedInvoice_SelectedIndexChanged(object sender, EventArgs e)
	{
		if (this.NeedInvoice.Items[0].Selected)
		{
			this.NeedInvoice.Items[1].Selected = false;
			this.Needinvoid = true;
		}
		else
		{
			this.NeedInvoice.Items[0].Selected = false;
			this.Needinvoid = false;
		}
	}
	protected void LbtPay_Click(object sender, EventArgs e)
	{
		this.Session["JuseSaleProduct"] = true;
		base.Response.Redirect("/Member/Shop_PaymentType.aspx");
	}
}
